package HotelSystem2;

import java.util.Scanner;

public class Hotel {
    Room[][] rooms = new Room[5][5];

    public Hotel() {
        for (int i = 0; i < rooms.length; i++) {
            for (int j = 0; j < rooms[i].length; j++) {
                rooms[i][j] = new Room((i + 1) * 1000 + j + 1);
            }
        }
    }

    public void show(){
        for (int i = 0; i < rooms.length; i++) {
            for (int j = 0; j < rooms[i].length; j++) {
                System.out.print(rooms[i][j].rid + " ");
            }
            System.out.println();

            for (int j = 0; j < rooms[i].length; j++){
                if(rooms[i][j].guest != null){
                    System.out.print(rooms[i][j].guest.name+" ");
                }else {
                    System.out.print(rooms[i][j].guest+" ");
                }
            }
            System.out.println();
        }
    }
    public void in() {
            Scanner scanner = new Scanner(System.in);
            int input_rid = scanner.nextInt();
            String input_guestName = scanner.next();
            String input_guestGid = scanner.next();
            int i = input_rid / 1000 - 1;
            int j = input_rid % 10 - 1;
            if (rooms[i][j].guest == null) {
                System.out.println("成功入住"+input_rid+"房间");
                rooms[i][j].guest = new Guest(input_guestName);
            } else {
                System.out.println("该房间已满，请重新选择其他住房。");
            }
        }
    public void out(){
            Scanner scanner = new Scanner(System.in);
            int input_rid = scanner.nextInt();
            int i = input_rid / 1000 - 1;
            int j = input_rid % 10 - 1;
            if (rooms[i][j].guest != null) {
                rooms[i][j].guest = null;
                System.out.println("退房成功");
            } else {
                System.out.println("空房间,退房失败,请重新输入");
            }
        }

    public void exit() {
        System.out.println("感谢您的使用，系统已退出…");
    }
}
